<template>
  <f7-page>
    <f7-navbar title="已定入住" back-link="Back">
      <f7-subnavbar :inner="false">
        <f7-searchbar
          search-container=".virtual-list"
          search-item="li"
          search-in=".item-title"
          :disable-button="!$theme.aurora"
        ></f7-searchbar>
      </f7-subnavbar>
    </f7-navbar>
    <f7-list class="searchbar-not-found">
      <f7-list-item title="Nothing found"></f7-list-item>
    </f7-list>
    <f7-list
      class="searchbar-found"
      virtual-list
      media-list
      v-for="(customer, index) in object"
      :key="index"
    >
      <ul>
        <f7-list-item
          link="/informationinput/"
          media-item
          @click="chuanzhi(customer.name,customer.type,customer.contact)"
          :title="customer.name"
          :after="customer.type"
          :text="customer.contact"
        ></f7-list-item>
      </ul>
    </f7-list>
  </f7-page>
</template>
<script>
import axios from "axios";
export default {
  data() {
    return {
      object: []
    };
  },
  mounted() {
    this.selectcustomer();
  },
  methods: {
    selectcustomer() {
      const self = this;
      const app = self.$f7;
      URL = "/caofuying/checkIn/selectCustomer";
      axios.get(URL, {}).then(r => {
        const { data } = r;
        if (data != null) {
          this.object = data;
        } else {
          app.dialog.alert("服务器错误");
        }
      });
    },
    chuanzhi(customername, type, contact) {
      let apiCheckIn = {
        customername,
        type,
        contact
      };
      this.$store.commit("setapiCheckIn", apiCheckIn);
    }
  }
};
</script>
<style scoped>
</style>
